package com.jwthhealth_pub.care.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;

import com.jwthhealth_pub.R;
import com.jwthhealth_pub.app.view.MainActivity;

/**
 * baojian msg adapter
 * Created by yang on 2017/12/13.
 */

public class CareMsgAdapter extends RecyclerView.Adapter {

    private MainActivity mActivity;

    public CareMsgAdapter(MainActivity activity) {
        this.mActivity = activity;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == MsgType.MSG.ordinal())
            return new ViewHolder(View.inflate(mActivity, R.layout.item_baojian_msg, null));
        else if (viewType == MsgType.SUBSCRIBE.ordinal())
            return new ViewHolder(View.inflate(mActivity, R.layout.item_baojian_msg, null));
        else
            return new ViewHolder(View.inflate(mActivity, R.layout.item_baojian_msg, null));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

    }

    @Override
    public int getItemCount() {
        // TODO: 2017/12/6 3
        return 3;
    }

    @Override
    public int getItemViewType(int position) {
        if (position == 0)
            return MsgType.MSG.ordinal();
        else if (position == 1)
            return MsgType.SUBSCRIBE.ordinal();
        else
            return MsgType.ORDER.ordinal();
    }

    private class ViewHolder extends RecyclerView.ViewHolder {

        ViewHolder(View itemView) {
            super(itemView);
        }
    }

    private enum MsgType {
        MSG, ORDER, SUBSCRIBE
    }
}
